Skip to content

refactor: add typescript [ECO-1017] #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 2, 2022

Conversation

karantalapalli
Copy link
Contributor

refactor: add typescript [ECO-1017]

@karantalapalli karantalapalli requested a review from a team as a code owner May 20, 2022 08:34
@@ -75,14 +86,14 @@ export default {
referenceFieldPath: `navigation_menu.page_reference`,
jsonRtePath: ['notification_bar.announcement_text']
});
let responsePages = await Stack.getEntries({
let responsePages: [PageResponse] = await Stack.getEntries({
contentTypeUid: 'page'
});
let navHeaderList = response[0].navigation_menu;
if (responsePages.length !== response.length) {
responsePages.forEach(entry => {
const hFound = response[0].navigation_menu.find(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use navHeaderList variable

<script lang="ts">

interface List {
author: [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type can be Array<any>

@@ -74,13 +89,13 @@ export default {
},
methods: {
async getData() {
const archived = [];
const recentPost = [];
const archived = [] as any;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as Array<any>

@@ -97,11 +112,10 @@ export default {
this.archivedList = archived;
this.$store.dispatch('setPage', data[0]);
this.$store.dispatch('setBlogpost', list);
document.title = this.banner.title;
const element = document.getElementsByClassName('cslp-tooltip');
const element: any = document.getElementsByClassName('cslp-tooltip');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if you can use this$refs to access DOM elements

Copy link
Contributor

@abhishek305 abhishek305 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use models instead of interfaces wherever applicable @karantalapalli

Comment on lines 39 to 47
interface Buckets{
title_h3: string;
description: string;
}

interface Data{
title_h2: string;
bucket: Buckets;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For individual components have a common file from were you export interface using models
reference: https://dev.to/jwp/typescript-models-and-javascript-objects-31b3

Comment on lines 42 to 56
interface Article {
href: string;
title: string;
}

interface Blogs {
featured_image: Image;
url: string;
}

interface Data {
title_h2: string;
view_articles: Article;
featured_blogs: Blogs;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For individual components have a common file from were you export interface using models.

Comment on lines +50 to +73
interface Header {
local: string;
logo: string;
navigation_menu: [];
notification_bar: string;
title: string;
}

interface Footer {
local: string;
logo: string;
copyright: string;
navigation: [];
social: string;
title: string;
}

interface Response {
page?: string;
blog_post?: string;
headers: Header;
footer: Footer;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use models as required

Comment on lines 51 to 59
interface PageResponse {
title: string;
url: string;
}

interface Links {
title: string;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use models

@abhishek305 abhishek305 self-requested a review May 24, 2022 11:16
@karantalapalli karantalapalli merged commit af3cef7 into staging Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants